package csel.controller.commands;

import java.awt.geom.Area;

import csel.controller.GameController;
import csel.model.ChronoTrigger;
import csel.model.Entity;
import csel.model.Model;
import csel.model.GameCommand;
import csel.view.*;

public class QuitCommand implements GameCommand
{
	private Splasher splashViewer;
	private StatusViewport statusViewer;
	private AreaViewport areaViewport;
	
	//constructs new Quit command
	public QuitCommand(Splasher splashViewer,
			StatusViewport statusViewer,
			AreaViewport areaViewport)
	{
		this.splashViewer = splashViewer;
		this.statusViewer = statusViewer;
		this.areaViewport = areaViewport;
	}
	
	//stops the chronotrigger, closes all windows and stops all threads in the controller
	public void execute()
	{
		ChronoTrigger.getInstance().stop();
		splashViewer.close();
		statusViewer.close();
		areaViewport.close();
		GameController.killController();
		System.out.println("[MODEL] the Quit command has been called");
	}

}